package com.qtenv.datasync.base;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName Page
 * @Author CBL
 * @Date 2020/5/22 10:09
 **/
public class Page<T> {
    /**
     * 查询数据列表
     */
    private List<T> records = Collections.emptyList();

    /**
     * 当前页
     */
    private long current = 1;
    /**
     * 总数
     */
    private long total = 0;
    /**
     * 每页显示条数，默认 10
     */
    private long size = 10;

    public Page(long current, long size) {
        this.current = current;
        this.size = size;
    }

    public Page(long current, long size, long total) {
        this.current = current;
        this.size = size;
        this.total = total;
    }

    public Page(List<T> records) {
        this.total = (records == null ? 0 : records.size());
        this.records = records;
    }

    public Page(long current, long size, long total, List<T> records) {
        this.current = current;
        this.size = size;
        this.total = total;
        this.records = records;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    public long getCurrent() {
        return current;
    }

    public void setCurrent(long current) {
        this.current = current;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }
}
